﻿using SuperFrame.Charts.SeriesParts;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Shapes;


namespace SuperFrame.Charts
{
    public class PartLine : BasePartLine
    {
        internal Line partLine;
        internal Ellipse ellipse;
        internal string Data1 = string.Empty;
        public PartLine()
        {

        }
        public PartLine(double x1, double x2, double y1, double y2)
        {
            this.X1 = x1;
            this.X2 = x2;
            this.Y1 = y1;
            this.Y2 = y2;
        }

        public PartLine(Point startPoint, Point endPoint, string data,string data1)
        {
            this.X1 = startPoint.X;
            this.X2 = endPoint.X;
            this.Y1 = startPoint.Y;
            this.Y2 = endPoint.Y;
            this.Data = data;
            this.Data1 = data1;
        }

        public override UIElement CreatePart()
        {
            partLine = new Line();
            partLine.X1 = this.X1;
            partLine.X2 = this.X2;
            partLine.Y1 = this.Y1;
            partLine.Y2 = this.Y2;
            SetBindingForStrokeandStrokeThickness(partLine);
            return partLine;
        }
        public override UIElement CreatePoint()
        {
            ellipse = new Ellipse();
            ellipse.Height = 6;
            ellipse.Width = 6;
            ellipse.ToolTip = this.Data;
            ellipse.SetValue(Canvas.LeftProperty, this.X1 - 2.9);
            ellipse.SetValue(Canvas.TopProperty, this.Y1 - 2.9);
            SetBindingForStrokeandFillThickness(ellipse);
            return ellipse;
        }
        public override UIElement CreateEndPoint()
        {
            ellipse = new Ellipse();
            ellipse.Height = 6;
            ellipse.Width = 6;
            ellipse.ToolTip = this.Data1;
            ellipse.SetValue(Canvas.LeftProperty, this.X2 - 3);
            ellipse.SetValue(Canvas.TopProperty, this.Y2 - 2.9);
            SetBindingForStrokeandFillThickness(ellipse);
            return ellipse;
        }
        public override void Refresh()
        {
            partLine.X1 = this.X1;
            partLine.X2 = this.X2;
            partLine.Y1 = this.Y1;
            partLine.Y2 = this.Y2;
        }
    }
}
